home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk52 / tutor / c2 < prev    next >
Text File  |  1995-03-18  |  10KB  |  335 lines

  1. Commands covered in this section:
  2.     ED
  3.     MAKEDIR
  4.     COPY
  5.     DIR
  6.     RENAME
  7.     RELABEL
  8.  
  9. ________________________________________________________________________________
  10.  
  11. ED
  12.  
  13.     ED is the text editor found in the C: directory on the WB disk.
  14. Your best bet is to get one of the reference books on AmigaDOS for the complete
  15. listing of commands, but I'll cover the basics here.
  16.     Typing in ED FILENAME will either allow you to edit an existing file
  17. or, if the file doesn't exist, it will create a new one.
  18.  
  19. >> CD ram:    /* ED writes to the current directory */
  20. >> ED foo
  21.  
  22.     Now just type in a few lines of whatever you feel like seeing. It
  23. doesn't matter and should neither be too long nor too important because this
  24. will ultimately be thrown away. This IS just a tutorial, I don't have time
  25. to wait for you to write the Great American Novel! But about 10-12 lines would
  26. be nice.
  27.  
  28.     The way ED works is it's a limited word processer in it's normal mode.
  29. But by hitting the <ESC> key it enters what's known as the extended command
  30. mode. This mode allows you to set blocks, write that block to another file,
  31. delete it, quit WITHOUT SAVING any changes, quit SAVING your changes, etc, etc.
  32.  
  33.     Some of the major EXTENDED commands you'll need to know are:
  34.         Q    quits and DOESN'T SAVE
  35.         X    quits and saves work
  36.         T    goes to top of file
  37.         BS    block start
  38.         BE    block end
  39.         B    goes to bottom of file
  40.         WB/filename/    writes to that file
  41.         DB    deletes a pre-defined block
  42.     All followed by a <RETURN>
  43.  
  44.     There are a lot more! And they can be joined together by using a
  45. semicolon ";".
  46.  
  47.     Now go back to the ED window and type in an <ESC>. What should have
  48. happened is that the cursor went from where ever it was to the bottom of the
  49. window and an asterisk "*" should have appeared. You're now in the extended
  50. command mode.
  51.     Hit <RETURN>.
  52.     The cursor went back to where it was and you're back in normal mode.
  53.  
  54.     Now move the cursor to the start of the second line of text and press
  55. <ESC>.
  56.     Now (be ready to watch what goes on when you hit <RETURN>) type:
  57.  
  58. * be;t;bs;wb/foo_2/<RETURN> 
  59.  
  60.     What happened was that it marked the bottom of a block /* be */, went
  61. to the top of the file /* t */, marked the top of a block /* bs */, and wrote
  62. a copy of that block to a file named "foo_2" in the current directory /* wb// */
  63.  
  64.     OK? You should have the cursor on the line at the bottom of the block
  65. you marked.
  66.  
  67.     Hit <ESC>
  68.  
  69. * be;t;bs;db <RETURN>
  70.  
  71.     This time it marked the same block but it deleted it.
  72.  
  73.         Hit <ESC>
  74.  
  75. * x <RETURN>
  76.  
  77.     If you'd have had a long enough file you would have seen the line
  78. "Writing to file" at the bottom of the screen as it exited.
  79.  
  80. >> DIR
  81. foo
  82. foo_2
  83.  
  84.     Right?
  85.  
  86.     So there's a start at editing text files.
  87.  
  88.  
  89. ________________________________________________________________________________
  90.  
  91. MAKEDIR
  92.  
  93.     creates new directories.
  94.  
  95. >> CD
  96. ram:
  97. >> MAKEDIR foo_stuff
  98. >> DIR
  99.  foo_stuff (dir)
  100. foo
  101. foo_2
  102.  
  103.     Pretty easy, eh? This works with any valid PATHNAME, IF that directory
  104. doesn't already exist!
  105.  
  106. ________________________________________________________________________________
  107.  
  108. COPY
  109.  
  110.     copies files from one place to another
  111.  
  112. >> COPY foo foo_stuff
  113. >> DIR foo_stuff
  114. foo
  115.  
  116.     It will also rename things in the process of coping if you give it
  117. the new name as part of the destination.
  118.  
  119. >> COPY foo foo_stuff/foo_3
  120. >> DIR foo_stuff
  121. foo
  122. foo_3
  123. >> TYPE foo
  124. >> TYPE foo_3
  125.  
  126.     The lines that appeared on the screen after both TYPE commands should
  127. have been the same.
  128.  
  129.     You can use two other options with copy. These act as switches and
  130. are ALL and QUIET. The ALL switch will copy an entire directory:
  131.  
  132. >> COPY df0:s ram: ALL
  133.  
  134.     The QUIET command prevents the command from printing the list to the
  135. screen as it's performing its tasks.
  136.  
  137. ________________________________________________________________________________
  138.  
  139. RENAME
  140.  
  141.     renames files
  142.     This WON'T JUST change from lower to uppercase /* or vice versa */.
  143. For instance, it wouldn't change "foo" to "Foo" since the CLI is not case
  144. sensitive. It would view both those names as identical, but "foo" and "foo."
  145. are totally different names as far as the DOS is concerned, so once again,
  146.             SPELLING IS IMPORTANT!!!
  147.  
  148. Now try:
  149. >> RENAME foo_stuff/foo_3 foo_3    /* think it will change this name? */
  150. >> DIR foo_stuff
  151. foo
  152. >> DIR    /* I am assuming you're still CDed to RAM:, if your not or aren't sure
  153.         check */
  154.  foo_stuff (dir)
  155. foo
  156. foo_2
  157. foo_3
  158.  
  159.     See what it did? Since I didn't give it the same PATHNAME, it moved
  160. foo_3 from the foo_stuff directory to the root directory. This is a common
  161. mistake, so if you rename something and it seems to get lost..check to be sure
  162. you didn't make this mistake.
  163.  
  164.     Another limitation, RENAME won't work across drives. It's not COPY, so
  165. you CAN'T do something like:
  166.     RENAME df1:foo df2:fum
  167.  
  168. _______________________________________________________________________________
  169.  
  170. RELABEL
  171.  
  172.     a "rename" but for disks
  173.  
  174.     The format for making the standard WB:c/RELABEL work is:
  175.  
  176.     RELABEL DRIVE df?: NAME whatever
  177.  
  178.  
  179. ________________________________________________________________________________
  180.  
  181. DIR
  182.  
  183.     tells you what is in a directory
  184.  
  185.     We've been using DIR alot so far and that's as it should be. If not
  186. critical, it's good to be able to track down information. Over and above the
  187. simple looking around we've been doing, there are a few options one can use
  188. with this command:
  189.  
  190.         OPT A and OPT I
  191.  
  192. >> DIR df0:
  193.      c (dir)
  194.      l (dir)
  195.      devs (dir)
  196.      s (dir)
  197.      T (dir)
  198.      fonts (dir)
  199.      libs (dir)
  200.      Examples (dir)
  201.      Film (dir)
  202.   .info                          CLI_tutorial.1
  203.   CLI_tutorial.2                 CLI_tutorial.3
  204.   CLI_tutorial.4                 CLI_tutorial.5
  205.   CLI_tutorial.6                 CLI_tutorial.intro
  206.   Disk.info                      Only.info
  207.   WB_axe
  208.  
  209.     That's good, but let's say you put a file on the disk, in a directory
  210. a while ago and you don't remember EXACTLY where it is.
  211.     You could go right down the line and DIR each directory individually
  212. or you can use OPT A.
  213.  
  214. >> DIR df0: OPT A
  215. /* I'm not going to waste the time or space to list everything that's going
  216. to appear, but you should be just about convinced that all the files on df0:
  217. have been listed. */
  218.  
  219.     OPT A goes into all the subdirectories it finds from where ever you
  220. start.
  221.  
  222. >> DIR devs: OPT A
  223. /* once again, I'm not going to list everything, but compare for yourself
  224. if you're sceptical */
  225.     It will have started with df0:devs and gone to the bottom of that
  226. directory, but no higher.
  227.  
  228.     What's that? You say you'd have liked to compare the results but
  229. they keep scrolling off the top. OK, we'll use "redirection" again. 
  230.  
  231. >> DIR >ram:df0_list df0: OPT A
  232.  
  233.     Now you won't get a list to the screen, but the drive light still
  234. comes on and it appears that the system's doing something. So when the prompt
  235. comes back...
  236.  
  237. >> DIR ram:
  238. /* all the "foo" stuff should still be here, as well as */
  239. df0_list
  240.  
  241. >> CD
  242. RAM: /* still */
  243. >> TYPE df0_list
  244. /* Now you'll get all the same information you got before, but with no more
  245. disk activity. Magic, you say? */
  246.  
  247.     Now OPT I...
  248.  
  249.     First a word of caution, the "I" is for interactive and since it is,
  250. it can be used to delete things.
  251.  
  252.     What will happen is that the system will display the first entry in
  253. the directory with a "?" after it. Assuming that it ISN'T a directory which
  254. is handled a little differently, the responses it will accept are:
  255.     <RETURN>    which tells DOS to leave it alone
  256.     T        which means you want it TYPEd /* not for binaries */
  257.     Q        quit
  258.     <CTRL>C        if you "T" a file, this causes it to stop and go back
  259.                 to the interactive mode
  260.             or
  261.     "D""E""L"    delete /* the three letters, not the <DEL> key */
  262.  
  263. For directories:
  264.     E        to enter it
  265.     B        to back up to the next higher level, but no higher than
  266.                 the initial entry level
  267.  
  268.     Directories can also be deleted as noted above, but only if they're
  269. empty.
  270.  
  271. >> CD
  272. RAM:    /* if not ">> CD ram:" !!! */
  273. >> DIR OPT I
  274. /* Since I'm trying to do this at all the opportunities that I get, I'm not
  275. reconstructing all the ram: based files. This is only a problem in that I
  276. can't tell you exactly which one will come up first. But by typing in the
  277. above commands, you can see how it works. One other thing, since we're
  278. going to be getting to the DELETE command next, don't delete the directory
  279. in your new found power. */
  280.  
  281.     You should be able to imagine how this option would come in handy
  282. for quick basic house cleaning; it doesn't require knowing exact PATHNAMES
  283. and it can do a whole disk if you so desire.
  284.  
  285.  
  286.  
  287. ________________________________________________________________________________
  288.  
  289. DELETE
  290.  
  291.         throws away all the junk that seems to get on your disks
  292.         without your knowing how
  293.  
  294.     Since you've been in ram: messing around with DIR OPT I, at this stage
  295. I'm not sure what you might have left, we'll use a little directory I've
  296. slipped in on you.
  297.  
  298.     The way you throw stuff away is:
  299.         DELETE PATHNAME/FILENAME
  300.  
  301.     Try it out on whatever you might have left in ram: /* you're still
  302. CDed there aren't you */, but once again, leave the foo_stuff directory,
  303. we'll get to it in a minute.
  304.  
  305. >> DIR
  306. /* now type DELETE and the name of any file you find */
  307. >> DELETE ________
  308. >> DIR
  309. /* you should have one less file there now than before */
  310.  
  311.     Go ahead and delete all the FILES in the list you got at the DIR
  312. command.
  313.  
  314.     DELETE will also do entire directories in much the same way that
  315. COPY does. Both the ALL and the QUIET switches can be used.
  316.     If you haven't turned your machine off since you started this 
  317. example, there should be two directories in ram: now: foo_stuff and s.
  318.  
  319. >> DIR foo_stuff
  320. /* the listing of what's in there */
  321. >> DELETE foo_stuff ALL
  322. /* a listing of all the files as they're deleted, ending with an entry telling
  323. you that foo_stuff was deleted too */
  324. >> DIR s
  325. startup-sequence
  326. >> DELETE s ALL QUIET
  327. >>
  328. >> DIR
  329. /* ram: should be empty at this time */
  330.  
  331. ________________________________________________________________________________
  332.  
  333.     This will do it for the second file, go on to CLI_Tutorial.3 
  334. whenever you're ready.
  335.